/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.isil.tia.service.impl;

import com.isil.tia.dao.AuditDao;
import com.isil.tia.domain.Audit;
import com.isil.tia.service.AuditService;
import java.util.Date;
import java.util.List;
import org.springframework.transaction.annotation.Transactional;

/**
 *
 * @author IVAN
 */
@Transactional(readOnly = true)
public class AuditServiceImpl implements AuditService {

    private AuditDao auditDao;

    public void setAuditDao(AuditDao auditDao) {
        this.auditDao = auditDao;
    }

    @Override
    @Transactional(readOnly = false)
    public void saveAudit(Object object,String accion) {
        Audit audit = new Audit();
        audit.setOperation(accion);
        audit.setQuery(object.toString());
        audit.setAudit_date(new Date());
        audit.setUser_id(1L);
        auditDao.saveAudit(audit);
    }

    @Override
    public List<Audit> getAllAudits() {
        return auditDao.getAllAudits();
    }



}
